<?php

class ReliableController extends Controller
{
	public function actionToplist()
	{
		$types = array('jianfei','qudou','suma','fuzhuang','shouji','meirong');
		$type = trim($_GET['type']);
		if(!$type || !in_array($type,$types)) $type = 'jianfei';
		
		$keyword = '';
		$pageInfo = array();
		switch ($type){
			case 'jianfei':
				$keyword = '减肥';
				$pageInfo['breadcrumbs'] = '减肥产品排行榜';
				$pageInfo['title'] = '真正不伤身的减肥药_效果最好的减肥产品_最值得信赖的减肥产品_淘宝正品减肥产品_减肥产品排行榜';
				$pageInfo['keywords'] = '不伤身体的减肥药,健康减肥,今年卖得最好的减肥产品,大家觉得有效的减肥产品,正品减肥药,无副作用的减肥药';
				$pageInfo['description'] = '不能为了减肥伤了身体.这里是大家一致反应比较好的减肥产品,正品减肥产品,都有消费者保障服务,不反弹,无效七天退换.';
			break;
			case 'qudou':
				$keyword = '祛痘';
				$pageInfo['breadcrumbs'] = '祛痘产品排行榜';
				$pageInfo['title'] = '大家都觉得有效的去痘产品_效果最好的祛痘祛疤祛斑产品_祛痘产品排行榜';
				$pageInfo['keywords'] = '最有效的去痘产品,最好的去疤产品,卖得最好的祛斑产品,去痘祛斑产品排行榜,去疤产品排行榜';
				$pageInfo['description'] = '还在为痘痕而烦恼吗?试试国际上最好的去痘去疤祛斑产品,让您的无痘青春,绽放靓丽光彩!';
			break;
			case 'meirong':
				$keyword = '美容';
				$pageInfo['breadcrumbs'] = '美容产品排行榜';
				$pageInfo['title'] = '大家都觉得有效的美容产品_效果最好的美容产品_美容产品排行榜';
				$pageInfo['keywords'] = '最有效的美容产品,最好的美容产品,卖得最好的美容产品,美容产品排行榜';
				$pageInfo['description'] = '还在为脸色难看而烦恼吗?试试国际上最好的美容护肤产品吧,让您的焕发青春,绽放靓丽光彩!';
			break;
			case 'suma':
				$keyword = '数码';
				$pageInfo['breadcrumbs'] = '时尚数码产品排行榜';
				$pageInfo['title'] = '最超值的数码产品_最火爆最流行的数码产品';
				$pageInfo['keywords']   = '最超值的数码产品,最新款数码相机,数码潮人必备';
				$pageInfo['description']= '拥有几件自己的超前卫数码产品,让您的工作得心应手.网购我帮您,帮您挑选最超值的数码产品.';
			break;
			case 'shouji':
				$keyword = 'android手机';
				$pageInfo['breadcrumbs'] = '手机产品排行榜';
				$pageInfo['title'] = '最超值的手机_最火爆最流行的手机,智能手机';
				$pageInfo['keywords']   = '最超值的手机,最新款手机,手机潮人必备';
				$pageInfo['description']= '拥有一部好手机,让您的工作得心应手.网购我帮您,帮您挑选最超值、最好用的手机.';
			break;
			case 'fuzhuang':
				$year = date('Y',time());
				$keyword = Yii::app()->params['fuzhuangkw'];
				$pageInfo['breadcrumbs'] = $year.'服装热卖榜';
				$pageInfo['title'] = $year.'最热卖的秋装_'.$year.'新款秋装火爆上市_'.$year.'时尚潮人必备';
				$pageInfo['keywords']    = $year.'年最新爆款,最好卖的秋装,秋季爆款,前卫时尚潮人必备,今年流行穿什么';
				$pageInfo['description'] = $year.'年最流行的秋装是什么?'.$year.'年大家都穿什么?来看看网购排行榜吧,在这里,你一定可以挑选到自己喜欢的款式!';
			break;
		}

		$config= array(
			'method' => 'taobao.taobaoke.items.get',
			'fields' => 'num_iid,title,pic_url,volume,price,shop_click_url,seller_credit_score,click_url',
			'page_size' => 15,
			'sort' => 'commissionVolume_desc',
			'start_credit' => '1crown',
			'sevendays_return' => '1',
			'real_describe' => '1',
			'cid' => 0,
			'keyword' => $keyword,
			'outer_code'=>'miyifun',
		);

		$api = new TaobaoApi($config);
		$result = $api->getData(86400000, 'push', $type.'.js');

		$this->render('toplist',array('pageInfo'=>$pageInfo,'data'=>$result['taobaoke_items_get_response']['taobaoke_items']['taobaoke_item']));
	}

}